<template>
	<!-- 订单详情(用户) -->
	<view class="orderDetail">
		<view class="orderDetailheader">{{orderType}}</view>
		<view class="orderDetail-main">
			<view v-if="orderType=='已完成'" class="complete">
				<view class="main-content">
					<view class="content-text">回收员</view>
					<view class="content-right">{{orderDetail.collectorName}}</view>
				</view>
				<view class="main-content">
					<view class="content-text">手机号码</view>
					<view class="content-right">{{orderDetail.collectorPhone}}</view>
				</view>
			</view>
			<view class="main" :style="orderType=='已完成'?'border-radius:0 0 20rpx 20rpx;':'margin-top: 20rpx;border-radius:20rpx;'">
				<view class="main-content">
					<view class="content-text">预约时间</view>
					<view class="content-right">{{orderDetail.reservetime}}</view>
				</view>
				<view class="main-content">
					<view class="content-text">上门地址</view>
					<view class="addressinfo">
						<view class="addressinfo-text">{{orderDetail.address}}</view>
						<view class="addressinfo-look" @tap="query_address"><text
								class="icon iconfont icon-weizhi"></text>查看位置</view>
					</view>
				</view>
				<view class="main-content">
					<view class="content-text">回收类型</view>
					<view class="content-right">{{orderDetail.type}}</view>
				</view>
				<view class="main-img">
					<view class="content-text">上传照片</view>
					<view class="uploadImg">
						<view class="uploadImg-box" v-for="(item,index) in orderDetail.pic_url" :key="index">
							<image :src="item" mode="aspectFill"></image>
						</view>
					</view>
				</view>
				<view v-if="orderType=='已预约'" class="main-content">
					<view class="content-text">提交时间</view>
					<view class="content-right">{{orderDetail.createtime}}</view>
				</view>
				<view v-else-if="orderType=='已完成'" class="main-content">
					<view class="content-text">完成时间</view>
					<view class="content-right">{{orderDetail.bidtime}}</view>
				</view>
				<view class="main-content">
					<view class="content-text">订单编号</view>
					<view class="content-right">{{orderDetail.logno}}</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import util from '../../component/commen/api/util';
	export default {
		data() {
			return {
				orderDetailId: "", //订单详情id
				orderDetail: "", //订单详情数据
				orderType: "", //类型
			};
		},
		onLoad(e) {
			this.orderType = e.orderType
			this.getdetailData(e.orderListId)
		},
		methods: {
			getdetailData(id) { //获取订单详情数据
				var params = {
					do: "reserve",
					op: "orderDetail",
					id: id
				}
				util.requestWithSign(params).then(res => {
					console.log("详情数据：", res)
					this.orderDetail = res.data
				})
			},
			query_address() {
				uni.openLocation({
					latitude: Number(this.orderDetail.lat),
					longitude: Number(this.orderDetail.lng),
					address: this.orderDetail.address,
					scale: 18,
					success: function(e) {
						console.log("success", e);
					}
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.orderDetail {
		.orderDetailheader {
			width: 100%;
			padding: 20rpx 0;
			background: #00b388;
			color: #fff;
			text-align: center;
			font-size: 26rpx;
			font-weight: bold;
		}

		.orderDetail-main {
			padding: 0 20rpx;
			.complete{
				margin-top: 20rpx;
				padding: 20rpx 40rpx;
				box-sizing: border-box;
				background: #fff;
				border-bottom: 2rpx solid #f7f7f7;
				border-radius: 20rpx 20rpx 0 0;
				.main-content{
					display: flex;
					// margin-top: 20rpx;
					padding: 30rpx 0;
					.content-text {
						font-size: 26rpx;
						width: 30%;
						color: #747373;
						// border: 1px solid #00b388;
						// margin-right: 70rpx;
					}
					
					.content-right {
						font-size: 26rpx;
						font-weight: bold;
						width: 70%;
						// border: 1px solid #f00;
					}
				}
			}
			.main {
				// margin-top: 20rpx;
				padding: 20rpx 40rpx;
				box-sizing: border-box;
				background: #fff;
				// border-radius: 20rpx;

				.main-content {
					display: flex;
					// margin-top: 20rpx;
					padding: 30rpx 0;

					.content-text {
						font-size: 26rpx;
						width: 30%;
						color: #747373;
						// border: 1px solid #00b388;
						// margin-right: 70rpx;
					}

					.content-right {
						font-size: 26rpx;
						font-weight: bold;
						width: 70%;
						// border: 1px solid #f00;
					}

					.addressinfo {
						.addressinfo-text {
							font-size: 26rpx;
							font-weight: bold;
						}

						.addressinfo-look {
							margin-top: 10rpx;
							font-size: 25rpx;
							color: #00b388;
						}
					}
				}

				.main-img {
					.content-text {
						color: #8b8a8a;
					}

					.uploadImg {
						display: flex;
						flex-wrap: wrap;

						.uploadImg-box {
							margin: 20rpx 10rpx;
							width: 200rpx;
							height: 100rpx;

							image {
								width: 100%;
								height: 100%;
							}
						}
					}
				}
			}
		}
	}
</style>